import request from '@/utils/request';

//设置请求列表数据参数类型
export interface reqTrademarkListParams {
  page:number,
  limit:number
}
//品牌类型的全部信息类型定义
export interface returnTrademarkItemType extends reqTrademarkMsgType{
  id: number,
}
//品牌信息定义
export interface reqTrademarkMsgType{
  tmName: string,
  logoUrl: string
}
export type trademarkListType = returnTrademarkItemType[]
export interface returnTrademarkType {
   records : trademarkListType,
   total : number,
   size : number,
   current : number,
   searchCount : boolean,
   pages : number
}
//获取trademark列表的请求
export const reqTrademarkList = ({page,limit}:reqTrademarkListParams) =>{
  return request.get<any,returnTrademarkType>(`/admin/product/baseTrademark/${page}/${limit}`)
}
//添加trademark的请求
export const reqAddTrademark = (trademark:reqTrademarkMsgType) =>{
  return request.post<any,null>(`/admin/product/baseTrademark/save` , trademark)
}
//删除trademark的请求
export const reqDeleteTrademark = (id:number) =>{
  return request.delete<any,null>(`/admin/product/baseTrademark/remove/${id}`)
}
//修改trademark的请求
export const reqUpdateTrademark = (trademarkParams:returnTrademarkItemType) =>{
  return request.put<any,null>(`/admin/product/baseTrademark/update`,trademarkParams)
}

//获取所有的品牌列表
export interface TmListType {
  id: number;
  tmName: string;
  logoUrl: string;
}
export const requestAllTmList = () => {
  return request.get<any, TmListType[]>(
    `/admin/product/baseTrademark/getTrademarkList`
  );
};
